package com.itliang.core.model.entity.equipment;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.itliang.config.DoubleSerialize2;
import com.itliang.utils.easyexcel.EquipmentDataStatusConverter;
import com.itliang.utils.easyexcel.EquipmentDataTypeConverter;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

/**
 * 数据表
 *
 * @TableName equipment_data
 */
@TableName(value = "equipment_data")
@Data
public class EquipmentData implements Serializable {
    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    @ExcelIgnore
    private Long id;

    /**
     * 采集的设备code
     */

    @ExcelProperty(value = "设备编码", index = 0)
    private String equipmentCode;

    /**
     * 采集数据
     */
    @JsonSerialize(using = DoubleSerialize2.class)
    @ExcelProperty(value = "数据", index = 1)
    private Double data;

    /**
     * 数据状态 0-未知 1-正常 2-异常
     */
    @ExcelProperty(value = "数据状态", index = 2, converter = EquipmentDataStatusConverter.class)
    private Integer isException;

    /**
     * 最小正常值
     */
    @ExcelProperty(value = "最小正常值", index = 3)
    private Double minData;

    /**
     * 最大正常值
     */
    @ExcelProperty(value = "最大正常值", index = 4)
    private Double maxData;

    /**
     * 数据类型
     */
    @ExcelProperty(value = "数据类型", index = 5, converter = EquipmentDataTypeConverter.class)
    private Integer dataType;

    /**
     * 收集数据时间
     */
    @ExcelProperty(value = "收集时间", index = 6)
    @ColumnWidth(30)
    private Date collectionTime;

    /**
     * 创建时间
     */
    @ExcelIgnore
    private Date createTime;

    /**
     * 更新时间
     */
    @ExcelIgnore
    private Date updateTime;

    /**
     * 是否删除
     */
    @TableLogic
    @ExcelIgnore
    private Integer isDeleted;

    @TableField(exist = false)
    @ExcelIgnore
    private static final long serialVersionUID = 1L;
}